Don't let the parent class's weird implementation run when the
widget is focused through other code paths (e.g. clicking on
the non-input part of it).
We still need to fix the behavior when you click in the
input twice (the first click shows the popup and the second
click hides it), but this is much better already.
Related to I21b8cff4048 in oojs-ui.
Bug: T149452
Change-Id: I08743c64ea32feace757e2a8626df2f5310cfbc9
// Events
// Add the filterInput as trigger
this.filterInput.$input
// Events
// Add the filterInput as trigger
this.filterInput.$input
- .on( 'focus', this.onFocusForPopup.bind( this ) );
+ .on( 'focus', this.focus.bind( this ) );
this.$element
.addClass( 'mw-rcfilters-ui-filterCapsuleMultiselectWidget' );
this.$element
.addClass( 'mw-rcfilters-ui-filterCapsuleMultiselectWidget' );
- mw.rcfilters.ui.FilterCapsuleMultiselectWidget.prototype.onFocusForPopup = function () {
+ mw.rcfilters.ui.FilterCapsuleMultiselectWidget.prototype.focus = function () {
// Override this method; we don't want to focus on the popup, and we
// don't want to bind the size to the handle.
if ( !this.isDisabled() ) {
this.popup.toggle( true );
// Override this method; we don't want to focus on the popup, and we
// don't want to bind the size to the handle.
if ( !this.isDisabled() ) {
this.popup.toggle( true );
+ this.filterInput.$input.get( 0 ).focus();
+ return this;
+ };
+
+ /**
+ * @inheritdoc
+ */
+ mw.rcfilters.ui.FilterCapsuleMultiselectWidget.prototype.onFocusForPopup = function () {
+ // HACK can be removed once I21b8cff4048 is merged in oojs-ui
+ this.focus();